<?php
$page_type = "A";
require_once 'header.php';

$client_id = $_POST["client_id"];
$password = $_POST["password"];

// Update record with the default password
$sql = "update CLIENT set Password='$password' where Client_ID='$client_id'";

$result_array = execute_sql_in_oracle($sql);
$result = $result_array["flag"];
$cursor = $result_array["cursor"];

if (!$result){
  $reset_error = 'Client ID('."<b><font color=\"black\">".$client_id."</font></b>".') password reset failed!';
  header("Location:client.php?reset_error=$reset_error");
}
else {
  // Record updated with default password
  $reset_success = 'Client ID('."<b><font color=\"black\">".$client_id."</font></b>".') password reset successfully!';
  header("Location:client.php?reset_success=$reset_success");
}
?>